package com.quwan.common.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

/**
 * @author quan
 * @date 2021-12-09 9:46
 */
@Getter
@AllArgsConstructor
public enum PaymentEnum {
    SYSTEM_PAY("0", "not", "buyItVip", "not", "payDispatchOrder","dispatchBefore","payment", "balancePay", "系统支付"),
    WX_PAY("1", "wxBuyItOrder", "wxBuyItVip", "wxBuyItBalance", "wxPayDispatchOrder","wxDispatchBefore","payment", "wxPay", "微信支付"),
    ALI_PAY("2", "zfbBuyItOrder", "zfbBuyItVip", "zfbBuyItBalance", "zfbPayDispatchOrder","zfbDispatchBefore","payment", "aliPay", "支付宝支付");
    /**
     * 支付方式
     */
    String type;
    /**
     * 下单回调
     */
    String order;
    /**
     * 支付充值vip回调
     */
    String vip;
    /**
     * 支付余额充值 回调
     */
    String balance;

    /**
     * 派单 回调
     */
    String dispatch;
    /**
     * 派单定金支付
     */
    String dispatchBefore;
    /**
     * 实例所属组件
     */
    String component;
    /**
     * 实例方法名称
     */
    String method;
    String tips;

    public static PaymentEnum getByType(String type) {
        for (PaymentEnum value : values()) {
            if (value.getType().equals(type)) {
                return value;
            }
        }
        return null;
    }
    public static PaymentEnum getByBuyIt(String buyIt) {
        for (PaymentEnum value : values()) {
            if (value.getOrder().equals(buyIt)||value.getVip().equals(buyIt)||value.getBalance().equals(buyIt)||value.getDispatchBefore().equals(buyIt)||value.getDispatch().equals(buyIt)) {
                return value;
            }
        }
        return null;
    }

}
